package main

import (
	"bufio"
	"os"

	"gitcode.com/deyiyangyang/gascheme/rep"
)

func main() {

	fi, err := os.Stdin.Stat()
	if err != nil {
		return
	}

	isPipe := (fi.Mode() & os.ModeCharDevice) == 0

	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)

	if isPipe {
		rep.StartPipe(in, out)
	} else {
		rep.StartTerminal(in, out)
	}
}
